// components/popup/couponChoose/couponChoose.js
Component({
	/**
	 * 组件的属性列表
	 */
	properties: {
		isShow: Boolean,
		data: Array,
		amount: Number
	},

	/**
	 * 组件的初始数据
	 */
	data: {
		chooseCoupon: null
	},

	/**
	 * 组件的方法列表
	 */
	methods: {
		closePopTap: function() {
			this.setData({
				isShow: false
			})
		},
		bindChange: function(e) {
			const userCouponId = parseInt(e.detail.value);
			this.data.chooseCoupon = this.data.data.find(it => it.user_coupon_id === userCouponId);
		},
		submit: function() {
			this.setData({
				isShow: false
			});
			this.triggerEvent('change', this.data.chooseCoupon)
		}
	}
});
